package com.jinghong.epidemiccontrolproject.mapper;

import com.jinghong.epidemiccontrolproject.pojo.Region;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName:RegionMapper
 * Package:com.jinghong.epidemiccontrolproject.mapper
 * Description:
 *
 * @Author: 寻月君子
 * @CreatTime:2024/1/20 15:01
 * Version:1.0
 */
@Mapper
public interface RegionMapper {


    /**
     * 分页查询
     *
     * @param name
     * @return
     */
    List<Region> list(String name);


    /**
     * 更新表中该地区该患病情况人数
     *
     * @param regionId
     * @param updateNum
     */
    void update(Integer regionId, Short status, Integer updateNum);

    @Select("select * from region where id = #{regionId}")
    Region getById(Integer regionId);

    @Insert("insert into region(name,certify_num,recover_num,death_num)" +
            " values(#{name},#{certifyNum},#{recoverNum},#{deathNum})")
    void add(String name, Integer certifyNum, Integer recoverNum, Integer deathNum);
}